package org.sunflower.test;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description:
 * @author: TanJingyu
 * @create: 2021-09-26 18:52
 **/
@RestController
@RequestMapping("/hello")
@Slf4j
public class HelloController {

    @GetMapping("/user")
    @Notice
    public String user(User user) {
        System.out.println("controller.....");
        System.out.println(user);
        return user.toString();
    }

    @GetMapping
    public String hello(String msg) {
        log.info("请求过来了！");
        return StringUtils.hasText(msg) ? msg : "msg没有值";
    }

    @Data
    public static class User {
        private String username;
        private Integer age;
    }
}
